﻿using Gengens.Disk.WebApi.dto.output;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Serilog;

namespace Gengens.Disk.WebApi.filter
{
    public class ExceptionFilter : IExceptionFilter
    {
        public void OnException(ExceptionContext context)
        {
            Log.Error("异常过滤器捕获", context.Exception);
            context.Result = new BadRequestObjectResult(ApiRet.Fail(context.Exception.Message));
        }
    }
}
